package com.huike.report.MpMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huike.common.entity.MPTbContract;
import com.huike.report.domain.dto.ReportSalesDeptStatisticsListVo;
import com.huike.report.domain.vo.ReportSubjectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ReportContractMapper extends BaseMapper<MPTbContract> {
    /**
     * 根据时间对学科分组，求学科名，和数量
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @Select("select dict_label subject, count(*) num\n" +
            "        from sys_dict_data\n" +
            "                 right join tb_contract on sys_dict_data.dict_value = tb_contract.subject\n" +
            "        where sys_dict_data.dict_type = 'course_subject'\n" +
            "        group by dict_label;")
    List<ReportSubjectVo> selectSubjectNum(LocalDateTime beginCreateTime, LocalDateTime endCreateTime);



    /**
     *销售统计归属部门明细列表
     * @param beginTime
     * @param endTime
     * @return
     */
    List<ReportSalesDeptStatisticsListVo> selectSoleNum(LocalDateTime beginTime, LocalDateTime endTime);
}
